//import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import { type RouteRecordRaw } from 'vue-router'
import { request } from '@/API/request'
import type { Component, VueElement } from 'vue'
import HomeView from '../views/HomeView.vue'
import TheWelcomeVue from '@/components/TheWelcome.vue'

const isDev = true

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'index',
    redirect: '/login', //设置默认指向的路径
    children: [
      {
        path: '/home',
        name: 'home',
        meta: { title: '主页布局' },
        component: () => import('../views/HomeView.vue'),
        redirect: '/general',
        children: [
          {
            path: '/user',
            name: 'user',
            component: () => import('../views/AboutView.vue'),
            meta: { title: '用户管理' }
          },
          {
            path: '/role',
            name: 'role',
            component: () => import('../views/AboutView.vue'),
            meta: { title: '角色管理' }
          },
          {
            path: '/resource',
            name: 'resource',
            component: () => import('../views/AboutView.vue'),
            meta: { title: '资源管理' }
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    meta: { title: '用户登录' },
    component: () => import('../views/LoginView.vue')
  }
]

export default routes
